package com.ruoyi;

import com.ruoyi.common.utils.uuid.UUID;
import org.junit.Test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class javaToPython {

    @Test
    public void test(){
        int a = 18;
        int b = 23;
        try {
            String py = "python3";
            String url = "/Users/yuzhicheng/project/python-video/spider/spider-wikiHow/ceshi.py";
            String id = UUID.randomUUID().toString();
            String file_url = "/Users/yuzhicheng/project/python-video";
            String[] args = new String[] { py, url, id, file_url };
            Process proc = Runtime.getRuntime().exec(args);// 执行py文件

            BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
            String line = null;
            while ((line = in.readLine()) != null) {
                System.out.println(line);
            }
            in.close();
            proc.waitFor();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
